/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tpgrandt.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

/**
 *
 * @author Sabbag
 */
public abstract class DAO {

	protected String _host;
	protected String _db;
	protected String _usr;
	protected String _pass;


	protected static final Statement getStatement() {
	    return getStatement("//localhost/", "tpdisenio", "root", "");
	}

	protected static final Statement getStatement(String host, String db, String usr, String pass) {
		try {
			//Class.forName("org.gjt.mm.mysql.Driver");
			Class.forName("com.mysql.jdbc.Driver");
			Connection conn = DriverManager.getConnection("jdbc:mysql:"+host + db, usr, pass);
			return conn.createStatement();
		} catch (ClassNotFoundException e) {
			//TODO Ver salida de error
			e.printStackTrace();
		} catch (SQLException e) {
			//TODO Ver salida de error
			e.printStackTrace();
		}
		return null;
	}
	
}

